
/*This .do-file includes complete information for the replication of the analysis in "International Financial Institutions and the Promotion of Autocratic Resilience" by Christina Cottiero and Christina J. Schneider 


To run this do-file, the following .dta-files are required: 
-- "ifi_analysis_dataset.dta"
-- "ifitype.dta"

The following packages do not come standard in Stata and need to be installed to run the .do file:
-- coefplot from : http://www.stata-journal.com/software/sj15-1
-- reghdfe fromL http://fmwww.bc.edu/RePEc/bocode/r/
-- plotplain from http://www.stata-journal.com/software/sj17-3
-- estab from:  http://www.stata-journal.com/software/sj7-2

All data analyses were carried out using Stata/SE 18.5 for Mac (Intel 64-bit).

*/


clear
version 18.5
clear all
set scheme plotplain



// Change working directory //

*cd "."


log using ifi_analysis, replace 


/// Replication of the IFI Descripictive Graphs ///

use IFItype, clear


/// Figure 1a ///


sort IO_id

twoway line vdemiomean year if  IO_id==5, sort || ///
line  vdemiomean year if IO_id==7, sort || ///
line  vdemiomean year if IO_id==8, sort || ///
line  vdemiomean year if IO_id==10, sort || ///
line  vdemiomean year if IO_id==11, sort || ///
line  vdemiomean year if IO_id==19, sort || ///
line  vdemiomean year if IO_id==22, sort || ///
line  vdemiomean year if IO_id==25, sort || ///
line  vdemiomean year if IO_id==27, sort || ///
,   scheme(plotplainblind) yline(0.5) xlabel(1960(10)2020) ylabel(0(.2)1) xtitle("Year", height(10)) ytitle("IFI Democracy Score") legend(all  label(1 "AFESD") label(2 "AMF") label(3 "APICORP") label(4 "BADEA") label(5 "BDEAC") label(6 "EFSD") label(7 "IsDB") label(8 "OPEC") label(9 "TDB") symxsize(5)) ysize(5)

graph export figure1a.jpg, replace



/// Figure 1b ///


twoway line vdemiomean year if  IO_id==2, sort || ///
line  vdemiomean year if  IO_id==3, sort || ///
line  vdemiomean year if IO_id==6, sort || ///
line  vdemiomean year if IO_id==9, sort || ///
line  vdemiomean year if IO_id==12, sort || ///
line  vdemiomean year if IO_id==13, sort || ///
line  vdemiomean year if IO_id==14, sort || ///
line  vdemiomean year if IO_id==15, sort || ///
line  vdemiomean year if IO_id==23, sort || ///
,   scheme(plotplainblind) yline(0.5) xlabel(1960(10)2020) ylabel(0(.2)1) xtitle("Year", height(10)) ytitle("IFI Democracy Score") legend(all  label(1 "AfDB") label(2 "AfDF") label(3 "AIIB") label(4 "AsDB") label(5 "BOAD") label(6 "BSTD") label(7 "CABEI") label(8 "CAF") label(9 "NDB") symxsize(5)) ysize(5)

graph export figure1b.jpg, replace




/// Appendix A, D, and E///

foreach var of varlist vdemiomean gdpw_vdemiomean fracautocio {

twoway line `var' year if year<2022 & IO_id==1, sort || ///
line `var' year if  IO_id==2, sort || ///
line  `var' year if IO_id==3, sort || ///
line  `var' year if  IO_id==4, sort || ///
line  `var' year if  IO_id==5, sort || ///
line  `var' year if  IO_id==6, sort || ///
line  `var' year if IO_id==7, sort || ///
line  `var' year if IO_id==8, sort || ///
line  `var' year if IO_id==9, sort || ///
line  `var' year if IO_id==10, sort || ///
line  `var' year if  IO_id==11, sort || ///
line  `var' year if IO_id==12, sort || ///
line  `var' year if IO_id==13, sort || ///
line  `var' year if  IO_id==14, sort || ///
line  `var' year if  IO_id==15, sort || ///
line  `var' year if  IO_id==16, sort || ///
line  `var' year if  IO_id==17, sort || ///
line  `var' year if IO_id==18, sort || ///
line  `var' year if IO_id==19, sort || ///
line  `var' year if IO_id==20, sort || ///
line  `var' year if IO_id==21, sort || ///
line  `var' year if IO_id==22, sort || ///
line  `var' year if IO_id==23, sort || ///
line  `var' year if IO_id==24, sort || ///
line  `var' year if IO_id==25, sort || ///
line  `var' year if IO_id==26, sort || ///
line  `var' year if IO_id==27, sort || ///
,  scheme(plotplainblind) yline(0.5) xlabel(1960(10)2020) ylabel(0(.2)1) xtitle("Year", height(10)) ytitle("GDP-Weighted IFI Democracy Score") legend(all label(1 "ACBF") label(2 "AfDB") label(3 "AfDF") label(4 "AFCO") label(5 "AFESD") label(6 "AIIB") label(7 "AMF") label(8 "APICORP") label(9 "AsDB") label(10 "BADEA") label(11 "BDEAC") label(12 "BOAD") label(13 "BSTDB") label(14 "CABEI") label(15 "CAF") label(16 "CDB") label(17 "CEDB") label(18 "EBRD")  label(19 "EFSD") label(20 "EC")  label(21 "IADB") label(22 "IsDB") label(23 "NDB") label(24 "NDF") label(25 "OPEC") label(26 "OSCE") label(27 "TDB") symxsize(5)) ysize(5)

graph export `var'_historical.jpg, replace
}



/// Appendix B ///

label define IFIlb 1 "ACBF" 2 "AfDB" 3 "AfDF" 4 "AFCO" 5 "AFESD" 6 "AIIB" 7 "AMF" 8 "APICORP" 9 "AsDB" 10 "BADEA" 11 "BDEAC" 12 "BOAD" 13 "BSTDB" 14 "CABEI" 15 "CAF" 16 "CDB" 17 "CEDB" 18 "EBRD" 19 "EFSD" 20 "EU" 21 "IADB" 22 "IsDB" 23 "NDB" 24 "NDF" 25 "OPEC" 26 "OSCE" 27 "TDB" 
label val IO_id IFIlb 

twoway line vdemiomean year if IO_id<28, sort by(IO_id,note("")) scheme(plotplain) yline(0.5) ytitle("IFI Democracy Score") xtitle("Year") 
graph export appendixB.eps, replace



// Appendix C ///

twoway line vdemiomean year if year<2022 & ioname=="WB" & year>1964, sort || ///
line vdemiomean year if  ioname=="IMF" & year>1964, sort || ///
line vdemiomean year if ioname=="UN" & year>1964, sort || ///
,  scheme(plotplain) yline(0.5) xlabel(1965(10)2020) xtitle("Year", height(10)) ytitle("IFI Democracy Score") legend(all label(1 "World Bank") label(2 "IMF") label(3 "United Nations")   symxsize(5))

graph export appendixC.jpg, replace


/// Replication of the Main Results ///

use ifi_analysis_dataset, clear 



/// Figure 3 ///


twoway line commitment_total_mio year if year>=1970&year<2021, sort scheme(plotplain) xtitle("Year") ytitle(Total IFI Aid (in millions))
graph export figure3.jpg, replace



/// Appendix F: Descriptive Statistics ///


quietly gen x = uniform()
quietly regress x commitment_log domconflict democracyaid_log  GDPpc2015USD  GDP2015USD_log kappavv_usa  vdemiomean capdist_log  if v2x_polyarchy<0.5 & sample_autocratic==1 & GDPpc2015USD<13845
estadd summ, mean sd min max
esttab using appendixF.rtf, replace  cells("mean sd min max") stats(N) drop(_cons) mlabels(,none) label varwidth(30) b(3)
drop x


/// Generate list of explanatory variables ///

vl create controls = (zGDPpc2015USD  zGDP2015USD_log zkappavv_usa  zvdemiomean zcapdist_log)
vl create controls_gdp = (zGDPpc2015USD zpopulation_log  zkappavv_usa  zvdemiomean zcapdist_log)
vl create mainivs = (zdomconflict zdemocracyaid_new_log)


/// Appendix G: Full Tabular Results ///

* Model 1 (tabular results for Figure 5)

reghdfe commitment_log $mainivs  $controls  if v2x_polyarchy<0.5 & sample_autocratic==1 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)
estimates store m1


* Figure 6a 

margins, at(zdomconflict=(-1(1)7)) atmeans vsquish post
marginsplot, recast(line)  legend(off) title("") xtitle("Domestic Anti-Government Conflict") ytitle("Predicted Aid (log)")  
graph export figure6a.jpg,replace

* Figure 6b 

reghdfe commitment_log  $mainivs  $controls  if v2x_polyarchy<0.5  & sample_autocratic==1   & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

margins, at(zdemocracyaid_new_log=(-1(0.5)3.5)) atmeans vsquish post
marginsplot, recast(line) legend(off) title("") xtitle("Democracy Promotion Aid") ytitle("Predicted Aid (log)")  
graph export figure6b.jpg,replace

* Model 2 (tabular results for Figure 7)

reghdfe commitment_log  $mainivs  $controls  if v2x_polyarchy>0.5  & sample_autocratic==1   & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)
estimates store m2

* Model 3 (tabular results for Figure 8)

reghdfe commitment_log  $mainivs  $controls  if v2x_polyarchy<0.5  & sample_democratic==1  & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)
estimates store m3



/// Figure 5 ///

 #delimit ;
coefplot (m1, label(Coefficient with 95% Confidence Intervals))
||,   order(zdomconflict zdemocracyaid_new_log) level(95) drop(_cons) ///
scheme(plotplain) xscale(range(-6(2)2)) xline(0,lpattern(dash) lcolor(gray)) ylabel(,labsize(small)) xtitle("",size(vsmall)) xlabel(,labsize(vsmall)) legend(row(1) position(6)) byopts(row(1));
 #delimit cr

graph export figure5.jpg,replace


/// Figure 7 ///

 #delimit ;
coefplot (m2, label(Coefficient with 95% Confidence Intervals))
||,   order(zdomconflict zdemocracyaid_new_log) level(95) drop(_cons) ///
scheme(plotplain) xscale(range(-4(2)4)) xline(0,lpattern(dash) lcolor(gray)) ylabel(,labsize(small)) xtitle("",size(vsmall)) xlabel(,labsize(vsmall)) legend(row(1) position(6)) byopts(row(1));
 #delimit cr

graph export figure7.jpg,replace


/// Figure 8 ///

 #delimit ;
coefplot (m3, label(Coefficient with 95% Confidence Intervals))
||,   order(zdomconflict zdemocracyaid_new_log) level(95) drop(_cons) ///
scheme(plotplain) xscale(range(-4(2)4)) xline(0,lpattern(dash) lcolor(gray)) ylabel(,labsize(small)) xtitle("",size(vsmall)) xlabel(,labsize(vsmall)) legend(row(1) position(6)) byopts(row(1));
 #delimit cr

graph export figure8.jpg,replace

/// Appendix H: Alternative Risk Variables /// 


* Model 1

reghdfe commitment_log  revztime_pass_cam  zdemocracyaid_new_log $controls  if v2x_polyarchy<0.5 & sample_autocratic==1& GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 2

reghdfe commitment_log  zv2cademmob  zdemocracyaid_new_log $controls  if v2x_polyarchy<0.5 & sample_autocratic==1 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 3

reghdfe commitment_log  zdomconflict  zdemocracyaid_log $controls if v2x_polyarchy<0.5 & sample_autocratic==1 & GDPpc2015USD<13845, vce(robust) absorb(regionyear IO_id)

* Model 4

reghdfe commitment_log  zdomconflict  spatialcoup_dum $controls  if v2x_polyarchy<0.5 & sample_autocratic==1 & GDPpc2015USD<13845, vce(robust) absorb(regionyear IO_id)

* Model 5

reghdfe commitment_log  zdomconflict  spatialdemocracy $controls  if v2x_polyarchy<0.5 & sample_autocratic==1& GDPpc2015USD<13845, vce(robust) absorb(regionyear IO_id)



/// Appendix I: Additional Results for Democratic Recipients ///

* Model 1

reghdfe commitment_log c.zdomconflict##c.v2x_polyarchy zdemocracyaid_new_log $controls  if sample_autocratic==1 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Figure Ia

margins, dydx(zdomconflict) at(v2x_polyarchy==(0(0.2)1))
marginsplot, recast(line)  legend(off) title("") xtitle("Democracy Score") ytitle("Marginal Effect of Anti-Government Conflict")  
graph export appendixIa.jpg,replace

* Model 2

reghdfe commitment_log zdomconflict c.zdemocracyaid_new_log##c.v2x_polyarchy  $controls  if sample_autocratic==1 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Figure Ib

margins, dydx(zdemocracyaid_new_log) at(v2x_polyarchy==(0(0.2)1))
marginsplot, recast(line)  legend(off) title("") xtitle("Democracy Score") ytitle("Marginal Effect of Aid from Democracies")  
graph export appendixIb.jpg,replace



/// Appendix J: IFI Sample ///


* Model 1

reghdfe commitment_log  $mainivs $controls  if v2x_regime<2 & sample_autocratic==1  & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 2

reghdfe commitment_log  $mainivs $controls  if e_boix_regime==0 & sample_autocratic==1  & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 3

reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & external==1 & sample_autocratic==1 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 4

reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & gdpw_vdemiomean<0.5  & IO_id!=7 & IO_id!= 19 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 5

reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & sample_gdpweighted==1   & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)


* Model 6

reghdfe commitment_log $mainivs  $controls  if v2x_polyarchy<0.5  & sample_autocratic_alt==1  & GDPpc2015USD<13845& year>1989  , vce(robust) absorb(regionyear IO_id)

* Model 7

reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & vdemiomean<0.5 &  IO_id!=7 & IO_id!= 19& GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 8

reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & fracautocio>=0.5 & IO_id!=7 & IO_id!= 19 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 9
reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & sample_autocratic_alt1==1 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)




/// Appendix K: Dependent Variable and Sample ///

* Model 1

reghdfe commitment_gdp  $mainivs  $controls_gdp if v2x_polyarchy<0.5 & sample_autocratic==1 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 2

reghdfe commitment_bin  $mainivs $controls  if v2x_polyarchy<0.5 & sample_autocratic==1  & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 3

reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & sample_autocratic==1  & year>1989, vce(robust) absorb(regionyear IO_id)

* Model 4

reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & sample_autocratic==1  & GDPpc2015USD<4495& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 5

reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & sample_autocratic==1  & GDPpc2015USD<13845, vce(robust) absorb(regionyear IO_id)

* Model 6

reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & sample_autocratic==1  &  IO_id!=1 & IO_id!= 2 & IO_id!=3 & IO_id != 9 & IO_id!= 14 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)



/// Appendix L: Explanatory Variables ///

* Model 1

reghdfe commitment_log  $mainivs $controls financialcrisis  if v2x_polyarchy<0.5 & sample_autocratic==1  & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 2

reghdfe commitment_log  $mainivs $controls zv2x_poly if v2x_polyarchy<0.5 & sample_autocratic==1  & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)


/// Appendix M: Model Specification ///


* Model 1

reghdfe commitment_log  $mainivs $controls  year if v2x_polyarchy<0.5 & sample_autocratic==1 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(region IO_id)

* Model 2

reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & sample_autocratic==1  & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 3

tobit commitment_log  $mainivs $controls i.regionyear i.IO_id   if v2x_polyarchy<0.5& sample_autocratic==1  & GDPpc2015USD<13845& year>1989, vce(robust) ll(0)

* Model 4

reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & sample_autocratic==1  &commitment_bin==1 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 5
heckman commitment_log $mainivs $controls i.regionyear i.IO_id if v2x_polyarchy<0.5& sample_autocratic==1  & GDPpc2015USD<13845& year>1989, twostep select(commitment_bin=$mainivs $controls  i.IO_id i.regionyear)

*Model 6

reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & sample_autocratic==1 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(regionyear IO_id)

* Model 7

reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & sample_autocratic==1 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(year IO_id region)

* Model 8

reghdfe commitment_log  $mainivs $controls year if v2x_polyarchy<0.5 & sample_autocratic==1 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(IO_id region)

* M0del 9

reghdfe commitment_log  $mainivs $controls  if v2x_polyarchy<0.5 & sample_autocratic==1 & GDPpc2015USD<13845& year>1989, vce(robust) absorb(IO_id year)

* Model 10

reghdfe commitment_log  $mainivs $controls year if v2x_polyarchy<0.5 & sample_autocratic==1  & GDPpc2015USD<13845& year>1989, vce(robust) absorb(IO_id ccodecow)

* Model 11
reghdfe commitment_log  $mainivs $controls if v2x_polyarchy<0.5 & sample_autocratic==1  & GDPpc2015USD<13845& year>1989, vce(robust) absorb(year IO_id ccodecow)

* Model 12

reghdfe commitment_log  revztime_pass_cam  zdemocracyaid_new_log $controls if v2x_polyarchy<0.5 & sample_autocratic==1  & GDPpc2015USD<13845&year>1989, vce(robust) absorb(ccodecow year IO_id)

* Model 13

reghdfe commitment_log  zv2cademmob  zdemocracyaid_new_log $controls if v2x_polyarchy<0.5 & sample_autocratic==1  & GDPpc2015USD<13845& year>1989, vce(robust) absorb(ccodecow year IO_id)

* Model 14

reghdfe commitment_log  zdomconflict  zdemocracyaid_log $controls if v2x_polyarchy<0.5 & sample_autocratic==1  & GDPpc2015USD<13845, vce(robust) absorb(ccodecow year IO_id)

* Model 15

reghdfe commitment_log  zdomconflict  spatialcoup_dum $controls if v2x_polyarchy<0.5 & sample_autocratic==1 & GDPpc2015USD<13845, vce(robust) absorb(ccodecow year IO_id)

* Model 16

reghdfe commitment_log  zdomconflict  spatialdemocracy $controls if v2x_polyarchy<0.5 & sample_autocratic==1 & GDPpc2015USD<13845, vce(robust) absorb(ccodecow year IO_id)


log close
exit

//end of analysis



